package cate.game.activity.wishblessing.msg;

import cate.common.util.GameResult;
import cate.game.GameBody;
import cate.game.activity.wishblessing.RoleWishBlessing;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBWishBlessing;
import easy.java.dev.note.NoteField;

@ClientMsg(title = "许愿祝福解锁ban位的请求")
public class WishBlessingUnlockReq implements MsgInput {
    @NoteField("功能ID")
    public int funcId;
    @NoteField("阵营")
    public byte camp;

    @Override
    public void execute(GameBody game, ClientContext cc) {
        RoleWishBlessing single = cc.getRole().getActivity().getEnableActivitySingle(funcId);
        if (single == null) {
            cc.getRole().getGame().notice.message(cc.getRole(), "活动未开启");
            return;
        }
        GameResult<Void> r = single.unlock(camp);
        if (!r.ok()) {
            game.notice.message(cc.getRole(), r.message);
        }
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBWishBlessing.UNLOCK_REQ;
    }
}
